package com.lc.afbx.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/7/6.
 */
@HttpInlet(Conn.INLET_API_INSURANCE_LIFE_DETAIL)
public class GetApiShouXianDetail extends BaseAsyGet<GetApiShouXianDetail.Info> {
    public String id;

    public GetApiShouXianDetail(AsyCallBack<GetApiShouXianDetail.Info> asyCallBack) {
        super(asyCallBack);
    }


    protected Info parser(JSONObject jsonObject) {

        TOAST = jsonObject.optString("message");

        if (jsonObject.optInt("code") == 200) {

            Info info = new Info();
            Data d = new Data();

            JSONObject o = jsonObject.optJSONObject("data");

            d.id = o.optString("id");
            d.title = o.optString("title");
            d.picurl = Conn.PIC + o.optString("picurl");
            d.deadline = o.optString("deadline");
            d.payment_is = o.optString("payment_is");
            d.premium = o.optString("premium");
            d.web1 = Conn.SERVICE + o.optString("web1");
            d.web2 = Conn.SERVICE + o.optString("web2");
            d.web3 = Conn.SERVICE + o.optString("web3");

            info.data = d;
            return info;
        }

        return null;
    }

    public static class Info {
        public Data data;
    }

    public static class Data implements Serializable {
//        "id": "1",
//                "title": "优惠车险",
//                "picurl": "/Uploads/20160519/pic_573d1016aef51.png",
//                "deadline": "1",
//                "payment_is": "2",
//                "premium": "1000",

        public String id, title, picurl, deadline, payment_is, premium, web1, web2, web3;
    }

}
